Skip to content

feat(cohere): upgrade integration from ai to gen_ai#5532

Draft
shellmayr wants to merge 14 commits intomasterfrom
shellmayr/feat/upgrade-cohere-ai-integration-from-ai-to-genai
Draft

feat(cohere): upgrade integration from ai to gen_ai#5532
shellmayr wants to merge 14 commits intomasterfrom
shellmayr/feat/upgrade-cohere-ai-integration-from-ai-to-genai

Conversation

@shellmayr
Copy link
Member

@shellmayr shellmayr commented Feb 25, 2026

This PR encompasses multiple changes to accomplish this

  • Add support for the "new" v2 of cohere which was released at the end of 2024. The cohere package continues to contain the v1 and v2 APIs, therefore we still need to support both. The instrumentation is in a separate file to prevent confusion between the versions.
  • Move the auto-instrumentation for v1 from ai.* attributes to gen_ai.* attributes
  • Adapt / add tests for v1 and v2
  • Has been run against two new templates for cohere in the testing framework
  • Semantically, Cohere is a model-provider on the level of e.g. anthropic and openai, meaning that there is no agentic flavor to this, it is "just" an API for LLM-calling for Cohere's own models

Closes TET-2023

@github-actions
Copy link
Contributor

github-actions bot commented Feb 25, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (cohere) Upgrade integration from ai to gen_ai by shellmayr in #5532

Bug Fixes 🐛

  • (celery) Propagate user-set headers by sentrivana in #5581

Documentation 📚

  • Add AGENTS.md by sentrivana in #5579
  • Add set_attribute example to changelog by sentrivana in #5578

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 25, 2026

Codecov Results 📊

134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 21.23s

All tests are passing successfully.

✅ Patch coverage is 86.69%. Project has 13242 uncovered lines.

Files with missing lines (5)
File Patch % Lines
utils.py 74.51% ⚠️ 65 Missing and 29 partials
v2.py 85.84% ⚠️ 16 Missing and 19 partials
v1.py 87.64% ⚠️ 11 Missing and 9 partials
__init__.py 84.21% ⚠️ 9 Missing and 3 partials
span_config.py 91.18% ⚠️ 3 Missing and 5 partials

Generated by Codecov Action

@linear
Copy link

linear bot commented Feb 27, 2026

GEN_AI_ALLOWED_MESSAGE_ROLES.SYSTEM: ["system"],
GEN_AI_ALLOWED_MESSAGE_ROLES.USER: ["user", "human"],
GEN_AI_ALLOWED_MESSAGE_ROLES.ASSISTANT: ["assistant", "ai"],
GEN_AI_ALLOWED_MESSAGE_ROLES.ASSISTANT: ["assistant", "ai", "chatbot"],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed because cohere sometimes uses the role chatbot in their message structure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant